If it is possible for your User Defined Function to produce an error, the Crystal Reports Formula Editor should be notified of the error. Many types of errors are automatically handled by the Formula Editor. Passing the wrong type of data to a function, for instance, will be recognized and trapped by Crystal Reports. However, if you design a function that can produce an error unique to that function, you should provide a means for reporting that error to the Formula Editor.
To send error messages to the Formula Editor, define the UFErrorText string property in your Class Module. This property should be defined Public, using code similar to this:
Any time you trap for an error condition, simply set the UFErrorText property to the error text you want reported in Crystal Reports. Setting the value of this property triggers the error in Crystal Reports, and Crystal Reports displays a dialog box containing the error message that you assigned to UFErrorText.
Note: You should not use the UFErrorText property for anything other than returning errors from User
Seagate Software IMG Holdings, Inc. http://www.seagatesoftware.com Support services: http://support.seagatesoftware.com |